<?php if ( !defined('BASEPATH')) exit('No direct script access allowed');

class unapplied_payments extends CI_Controller {

	public function __construct(){
		parent::__construct();
		$this->load->model('wus');
		$this->load->model($this->session->userdata('formodel'));
		$this->load->library('variable');
		$this->load->library('PHPexcel');
		$this->load->helper('download');
		$this->load->helper('file');

	}
	public function index(){
	  $this->load->view('layouts/header',$this->variable->load_data($this->session->userdata('title')));
	  $this->load->view($this->session->userdata('formain'),array('accounts' => $this->unapplied_payments_model->getallaccounts()));
	  $this->load->view('layouts/footer');
	 }


	 public function get_status_mr(){
	 	$body = '';
	 	$meter_reader  = $this->input->post('meter_reader');
	 	$year = $this->input->post('year');
	 	$month   = $this->input->post('month');
	 	$head = "<tr><th>Receipt Number</th><th>unappliedlied Amount</th></tr>";
	 	$result = $this->unapplied_payments_model->get_status($meter_reader);
	 	$tmp;
	 	if(!empty($result)){
	 		foreach($result as $r){
		 		$body .= "<tr><td align='right'>".$r->receipt_number."</td><td align='right'>".$r->adv_pay."</td></tr>";
		 	}
		 }else{
		 	$body = "";
		 }

		echo json_encode(array('head' => $head, 'body' => $body));		
	 }
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */